<template>
  <div>
    News
    <div>
      <button @click="toNewsItem('哈哈哈1')">新闻一</button>
      <button @click="toNewsItem('哈哈哈2')">新闻二</button>
      <button @click="toNewsItem('哈哈哈3')">新闻三</button>
    </div>
    <router-view></router-view>
  </div>
</template>

<script lang="ts">
import {defineComponent} from "vue";

export default defineComponent({
  name: "News",
});

</script>

<script lang="ts" setup>
import {useRouter} from "vue-router";

const router = useRouter()
const toNewsItem = (title: string) => {
  router.push({
    name: 'newsItem',
    query: {
      title
    }
  })
}
</script>

<style lang="scss" scoped>

</style>